package com.Lyy.Controller;

import com.Lyy.Entity.Book;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;
import java.util.List;

@Controller
public class WebTC {
    @RequestMapping("getHeft")
//    http://localhost/getString
    public String Test0() {
        return "index.jsp";
    }

    @RequestMapping("getString")
    //     http://localhost/getString
    @ResponseBody
    public String Test1() {
        return "string";
    }

    @RequestMapping(value = "getbook")
    //     http://localhost/getbook
    @ResponseBody
    public Book Test2() {
        Book book = new Book(1, "oo1", "Au1",200.00,"15","200");
        return book;
    }
    @RequestMapping("getListBook")
    @ResponseBody
    public List<Book> getListBook(){
        List<Book> bookList = new ArrayList<Book>();

        return bookList;
    }

    @RequestMapping(value = "setbook")
    //        http://localhost/setbook
    //        http://localhost/setbook?bookId=1&bookName=book1&bookAuthor=Au1
    @ResponseBody
    public Book Test3(Book book) {
        return book;
    }

}
